package user;

import book.BookList;
import operation.*;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: yinsh
 * Date: 2025-01-13
 * Time: 20:18
 */
public class AdminUser extends User{
    public void doOperation(int choice){
        IOperation[] iOperations = new IOperation[]{
                new ExitOperation(),
                new FindOperation(),
                new AddOperation(),
                new DelOperation(),
                new ShowOperation()
        };
        iOperations[choice].work(bookList);
    }
    @Override
    public void menu() {
        while (true) {
            System.out.println("********欢迎 " + this.name + "  来到管理系统**********");
            System.out.println("1.查找图书");
            System.out.println("2.添加图书");
            System.out.println("3.删除图书");
            System.out.println("4.查看图书");
            System.out.println("0.退出系统");
            System.out.println("**************************************************");
            Scanner scan = new Scanner(System.in);
            doOperation(scan.nextInt());
        }
    }
    public AdminUser(String name) {
        super(name);
    }
}
